#pragma once



// using win32
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <atlbase.h>
#include <atlapp.h>
#include <vector>
#endif




inline wchar_t* A2U(const char* value, int length=0)
{
	if(!length)
		length = strlen(value);

	wchar_t* p = new wchar_t[length + 1];

#ifdef WIN32
	MultiByteToWideChar(CP_UTF8, 0, value, length, p, length);
#else
	//
#endif

	p[length] = L'\0';
	return p;
}

inline char* U2A(const wchar_t* value, int length)
{
	if(!length)
		length = wcslen(value);

	char* p = new char[length + 1];

#ifdef WIN32
	WideCharToMultiByte(CP_UTF8, 0, value, length, p, length, NULL, NULL);
#else
	//
#endif

	p[length] = '\0';
	return p;
}

//#define SetWindowFont(...)
//#define SetWindowFont(ctl)
void SetWindowFont(ATL::CWindow& ctl, LCID locale=0);

class MaterialStore sealed
{
private:
	MaterialStore();
	~MaterialStore();

public:
	static const MaterialStore* Current();
	static void Destory();

	const HBRUSH BackgroundBrush() const;
	const COLORREF ForegroundColor() const;
	const HFONT WesternFont() const;
	const HFONT EasternFont() const;

private:
	HFONT CreateCompatibleFont(LCID);

	static MaterialStore* _instance;

	HBRUSH _bkgroundBrush;
	COLORREF _foregroundColor;
	HFONT _western;
	HFONT _eastern;
};
